package com.akkainaction.helloactor.life.actor;

import akka.actor.ActorRef;
import akka.actor.Props;
import akka.actor.UntypedActor;
import akka.event.Logging;
import akka.event.LoggingAdapter;

public class WatchActor extends UntypedActor {

    LoggingAdapter log = Logging.getLogger(this.getContext().system(), this);

    ActorRef child = null;

    @Override
    public void preStart() throws Exception {
        log.info("WatchActor preStart");
        child = getContext().actorOf(Props.create(WorkerActor.class), "workerActor");
    }

    @Override
    public void postStop() throws Exception {
        log.info("WatchActor postStop");
    }

    @Override
    public void onReceive(Object msg) throws Exception {
        log.info("WatchActor收到消息：" + msg);
    }
}
